package com.cg.controller;

import com.cg.client.AppClient;
import com.cg.dto.Result;
import com.cg.entity.Area;
import com.cg.vo.AreaListVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName AreaController
 * @Description TODO
 * @Author CG
 * @Date 2024/1/4 16:16
 **/
@RestController
@RequestMapping("/area")
public class AreaController {


    @Resource
    private AppClient appClient;

    /**
     * 查询省
     */
    @GetMapping("/queryProvince")
    public Result<List<Area>> queryShen(){
        return appClient.queryShen();
    }


    /**
     * 查询市
     */
    @GetMapping("/queryCity")
    public Result<List<Area>> queryShi(Integer areaId){
        return appClient.queryShi(areaId);
    }

    /**
     * 查询区
     */
    @GetMapping("/queryArea")
    public Result<List<Area>> queryQu(Integer areaId){
        return appClient.queryQu(areaId);
    }


    /**
     * 省市区级联，查询省市区
     */
    @GetMapping("/getAreas")
    public Result<List<AreaListVo>> getAreas(){
        return appClient.getAreas();
    }
}
